<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>get(5) 传入 5 计算出 5，传入 6 计算出 8，传入几就算出第几位数</title>
</head>

<body>
  <script>
    function num(n) {
      if (n < 1) {
        return n;
      } else if (n <= 2) {
        return 1;
      }
      return num(n - 1) + num(n - 2);
    }
    console.log(num(6));
  </script>
</body>

</html>